<template>
	<!-- 团课分类 -->
	<view class="pageV">
		<z-paging ref="paging" :auto="false" v-model="dataList" refresher-enabled="false">
			<u-navbar slot="top" title="团课列表" placeholder :autoBack="true" leftIconColor="#E6A5B4" bgColor="#000000"
				:titleStyle="titleStyle">
			</u-navbar>
			<view slot="left" class="leftV">
				<scroll-view scroll-y="true" style="max-height: 90vh;">
					<view v-for="(leftData,leftIndex) in dataList" :key="leftIndex"
						:class="leftPos == leftIndex?'leftItemVTo':'leftItemV'"
						@click="onLeftSeleteClick(leftData,leftIndex)">{{leftData.name}}</view>
				</scroll-view>
			</view>
			<view class="rightV">
				<view @click="onRightItemClick(rightData,rightIndex)" class="rightItemV"
					v-for="(rightData,rightIndex) in rightList" :key="rightIndex">
					<image class="rightItemIv" :src="rightData.image" mode="aspectFill"></image>
					<text class="rightItemTv1">{{rightData.title}}</text>
					<text class="rightItemTv2">{{rightData.target}}</text>
				</view>
			</view>
		</z-paging>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				titleStyle: {
					"color": "#ffffff"
				},
				dataList: [],
				rightList: [],
				leftPos: 0,
			}
		},
		onLoad() {
			this.getCategory()
		},
		methods: {
			getCategory() { //获取门店详情
				this.$api.getCategory({

				}).then((res) => {
					this.dataList = res;
					this.rightList = res[0].list
				}).catch((e) => {

					uni.$u.toast(e.msg === undefined ? "获取信息失败" : e.msg)
				})
			},
			onLeftSeleteClick(item, index) {
				this.leftPos = index;
				this.rightList = item.list;
			},
			onRightItemClick(item, index) {
				this.$u.route({
					url: '/pages/schedule/GroupDetails',
					params: {
						id: item.id,
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.pageV {
		display: flex;
		flex-direction: column;
	}

	.leftV {
		background-color: #FFFFFF;
		width: 200rpx;
		height: 100%;
	}

	.leftItemV {
		height: 90rpx;
		font-size: 28rpx;
		font-family: PingFang-SC-Medium, PingFang-SC;
		font-weight: 500;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		background-color: #1f1f1f;
	}

	.leftItemVTo {
		height: 90rpx;
		font-size: 28rpx;
		font-family: PingFang-SC-Medium, PingFang-SC;
		font-weight: 500;
		color: #E6A5B4;
		display: flex;
		align-items: center;
		justify-content: center;
		background-color: #FFFFFF;
	}

	.rightV {
		background-color: #FFFFFF;
	}

	.rightItemV {
		padding-left: 20rpx;
		padding-right: 20rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		margin: 30rpx;
		background-color: #1f1f1f;
		border-radius: 10rpx;

		.rightItemIv {
			width: 100%;
			height: 200rpx;
			border-top-left-radius: 10rpx;
			border-top-right-radius: 10rpx;
		}

		.rightItemTv1 {
			width: 100%;
			font-size: 32rpx;
			font-family: PingFang-SC-Medium, PingFang-SC;
			font-weight: 500;
			margin-top: 20rpx;
			color: #e8e8e8;
		}

		.rightItemTv2 {
			width: 100%;
			font-size: 24rpx;
			font-family: PingFang-SC-Medium, PingFang-SC;
			font-weight: 500;
			color: #979797;
			margin-top: 5rpx;
			display: -webkit-box;
			overflow: hidden;
			text-overflow: ellipsis;
			word-wrap: break-word;
			white-space: normal !important;
			-webkit-line-clamp: 1;
			-webkit-box-orient: vertical;
		}
	}
</style>